<?php
/**
* 名称：广告模型类。
* 描述：广告模块业务逻辑的相关程式。
*/
final class Model_Ad extends Model{
    /**
    * 描述：获取新闻主页的广告数据。
    * @static
    * @access public
    * @return array
    */
    public static function NewsIndex(){
        $data=self::$Database->GetAll(
            'SELECT * FROM '.self::$Database->Table('ad').' WHERE id in(5,6,7,8) ORDER BY id ASC'
        );
        //~
        foreach($data as &$row){
            $row['picture']=BUILD_PATH.'/data/000/ad/'.$row['picture'];
        }
        //~
        return array(
            'x0001'=>$data[0],'x0002'=>$data[1],'x0003'=>$data[2],'x0004'=>$data[3]
        );
    }

    /**
    * 描述：获取主页的广告数据。
    * @static
    * @access public
    * @return array
    */
    public static function Index(){
        $data=self::$Database->GetAll(
            'SELECT * FROM '.self::$Database->Table('ad').' WHERE id in(1,2,3,4) ORDER BY id ASC'
        );
        //~
        foreach($data as &$row){
            $row['picture']=BUILD_PATH.'/data/000/ad/'.$row['picture'];
        }
        //~
        return array(
            'x0001'=>$data[0],'x0002'=>$data[1],'x0003'=>$data[2],'x0004'=>$data[3]
        );
    }

    /**
    * 描述：供给数据之内参。
    * @static
    * @access public
    * @return array
    */
    public static function IRRS(){
        $data=self::$Database->GetAll(
            'SELECT * FROM '.self::$Database->Table('ad').' WHERE id in(9,10) ORDER BY id ASC'
        );
        //~
        foreach($data as &$row){
            $row['picture']=BUILD_PATH.'/data/000/ad/'.$row['picture'];
        }
        //~
        return array(
            'x0001'=>$data[0],'x0002'=>$data[1]
        );
    }

    /**
    * 描述：供给数据之内参。
    * @static
    * @access public
    * @return array
    */
    public static function Exhibition(){
        $data=self::$Database->GetAll(
            'SELECT * FROM '.self::$Database->Table('ad').' WHERE id in(11) ORDER BY id ASC'
        );
        //~
        foreach($data as &$row){
            $row['picture']=BUILD_PATH.'/data/000/ad/'.$row['picture'];
        }
        //~
        return array(
            'x0001'=>$data[0]
        );
    }
}